<template>
	<view class="index-main " :data-theme="theme">
		
		
		
		<view v-if="!errorNetwork" >
			<view class="page-index " >
				<!-- #ifdef H5 -->
				<!-- <view class="header ">
					<view class="serch-wrapper flex">
						<navigator url="/pages/city_select/index skeleton-rect" hover-class="navigator-hover">
							<view class="font-size-30 search-area-block" style="color:#000;margin-left: 8px;">
								<view style="font-weight: 600;">{{city?city:'切换城市'}}</view>
								<view class="triangle-border-down" style="margin:8rpx 32rpx 0 8rpx; border-top-color:#000"></view>
							</view>
						</navigator>
						<navigator url="/pages/search/index" class="input skeleton-rect" hover-class="none"><text
								class="iconfont icon-xiazai5"></text>
							输入|公交线路|站点</navigator>
					</view>
				</view> -->
				<!-- #endif -->
				<!-- #ifdef MP-WEIXIN || APP-PLUS -->
				<!-- view class="mp-header ">
					<view class="sys-head " :style=" 'height:'+ statusBarHeight  + 'px'"></view>
					<view class="serch-box " style="height: 40px;">
						<view class="serch-wrapper display-flex " >
							<navigator url="/pages/city_select/index" class="" hover-class="navigator-hover">
								<wSkeleton  rowWidth="60px" titleHeight="30px" title animate :loading="showSkeleton">
								<view class="font-size-30 search-area-block" style="color:#000;margin-left: 8px;">
									<view style="font-weight: 600;">{{city?city:'切换城市'}}</view>
									<view class="triangle-border-down" style="margin:8rpx 32rpx 0 8rpx; border-top-color:#000"></view>
								</view>
								</wSkeleton>
							</navigator>
							<wSkeleton  rowWidth="180px" titleHeight="30px" title animate :loading="showSkeleton">
							<navigator url="/pages/search/index" class="input " hover-class="none"><text
									class="iconfont icon-xiazai5"></text>
								输入|公交线路|站点</navigator>
							</wSkeleton>	
						</view>
					</view>
				</view> -->
				<!-- #endif -->
				<!-- #ifdef MP-ALIPAY -->
				<!-- <view class="mp-header ">
					<view class="sys-head " style="height:5px"></view>
					<view class="serch-box " style="height: 40px;">
						<view class="serch-wrapper display-flex display-flex-justify-space-between" >
							<navigator url="/pages/city_select/index" class="" hover-class="navigator-hover">
								<wSkeleton  rowWidth="60px" titleHeight="30px" title animate :loading="showSkeleton">
								<view class="font-size-30 search-area-block" style="color:#000;margin-left: 8px;width: 70px;">
									<view style="font-weight: 600;">{{city?city:'切换城市'}}</view>
									<view class="triangle-border-down" style="margin:8rpx 32rpx 0 8rpx; border-top-color:#000"></view>
								</view>
								</wSkeleton>
							</navigator>
							<wSkeleton  rowWidth="180px" titleHeight="30px" title animate :loading="showSkeleton">
							<navigator url="/pages/search/index" class="input " hover-class="none"><text
									class="iconfont icon-xiazai5"></text>
								输入|公交线路|站点</navigator>
							</wSkeleton>	
						</view>
					</view>
				</view> -->
				<!-- #endif -->
				<!-- #ifndef MP-ALIPAY -->
				<!-- <view class="" :style="'margin-top:'+(statusBarHeight+40)+'px;'">
					
				</view> -->
				<!-- #endif -->
				<!-- #ifdef MP-ALIPAY -->
				<!-- <view class="" :style="'margin-top:'+(45)+'px;'">
					
				</view> -->
				<!-- #endif -->
				<!-- 新闻简报 -->
				<view v-if="roll.length" class='notice acea-row row-middle row-between '
					>
					<!-- <wSkeleton  rowWidth="80px" titleHeight="30px" title animate :loading="showSkeleton">				
					</wSkeleton> -->
					<image class="pic skeleton-rect" src="../../static/images/xinjian.png" ></image>
					<view class='line2'>|</view>
					<!-- <wSkeleton  rowWidth="180px" titleHeight="30px" title animate :loading="showSkeleton">
					</wSkeleton> -->
					<view class='swipers skeleton-rect'>
						<swiper :indicator-dots="indicatorDots" :autoplay="autoplay" interval="2500" duration="500"
							vertical="true" circular="true">
							<block v-for="(item,index) in roll" :key='index'>
								<swiper-item @touchmove.stop="stopTouchMove">
									<view class='item' @click="navToPath(item)">
										<view class='line1'>{{item.name}}</view>
									</view>
								</swiper-item>
							</block>
						</swiper>
					</view>
					<view class="iconfont icon-xiangyou" ></view>
				</view>
				
				<view class="search-line-block " >
					<navigator id="address_start" openType="navigate" url="/pages/bus/search_address/index?type=1&&op=shouye" >
						<view class="address-item address-start ">
							<wSkeleton  rowWidth="10px" titleHeight="10px" title animate :loading="showSkeleton">
							<image class="address-icon" src="../../static/images/bus/station_start_icon.png"></image>
							</wSkeleton>
							<wSkeleton  rowWidth="260px" titleHeight="30px" title animate :loading="showSkeleton">
							<view bindtap="onStartAddressTap" :class="!from_address.name?'search-input-text-nocontent':''" class="address-name single-line-ellipsis"> {{from_address.name||'请输入出发地'}} </view>
						    </wSkeleton>
						</view>
					</navigator>
					<image class="address-line-icon" src="../../static/images/bus/station_start_bar_end.png"></image>
					<view class="separation-line"></view>
					<navigator id="address_end" openType="navigate" url="/pages/bus/search_address/index?type=2&&op=shouye"> 
						<view class="address-item address-start ">
							<wSkeleton  rowWidth="10px" titleHeight="10px" title animate :loading="showSkeleton">
							<image class="address-icon" src="../../static/images/bus/station_end_icon.png"></image>
							</wSkeleton>
							<wSkeleton  rowWidth="260px" titleHeight="30px" title animate :loading="showSkeleton">
							<view bindtap="onEndAddressTap" class="address-name single-line-ellipsis" style="color:#cacaca">请输入目的地</view>
							</wSkeleton>
						</view>
					</navigator>
				</view>
				
				<view class="page_content "  >
					<view class="display-flex menus" style="flex-wrap: wrap;margin: 10px;">
					
						<view v-if="menuList.length&&!(aliPayFlag && menuItem.name=='动态公交')" class=" menu-block "  v-for="(menuItem,menuIndex) in menuList" :key="menuIndex"  @click="navToPath(menuItem)">
							<view class="item-content display-flex display-flex-column">
								<image v-if="menuIndex==0" :animation="animationDataddx"  class="block-img"  :src="menuItem.icon"></image>
								<image v-else-if="menuIndex==3" :animation="animationDatatd"  class="block-img"  :src="menuItem.icon"></image>
								<image v-else-if="menuIndex==7" :animation="animationDatasf"  class="block-img"  :src="menuItem.icon"></image>
								<!-- <view v-else-if="aliPayFlag && menuItem.name=='动态公交'" style="display: none;" ></view> -->
								
								<image v-else class="block-img"  :src="menuItem.icon"></image>
								<text v-if="!(aliPayFlag && menuItem.name=='动态公交')" class="block-text single-line-ellipsis">{{menuItem.name}}</text>
							</view>
						</view>
						<!-- #ifndef H5 -->
						<wSkeleton v-for="(i,m) in 10" :key="i" class="menu-block " radius rowWidth="60px" titleHeight="60px" title animate :loading="showSkeleton">
							
						</wSkeleton>
						<!-- #endif-->
					</view>
				   <view class="swiper skeleton-rect">
				<!-- 	   <wSkeleton style="background-color: #fff;" rowWidth="360px" titleHeight="120px" title animate :loading="showSkeleton"> -->
						<swiper indicator-dots="true" class="skeleton-rect" :autoplay="true" :circular="circular" :interval="interval"
							:duration="duration" indicator-color="rgba(255,255,255,0.6)" indicator-active-color="#fff">
							<block v-for="(item,index) in bannerList" :key="index">
								<swiper-item>
									<view  @click="clickSwip(index)">
										<image :src="item.image" class="slide-image" ></image>
									</view>
								</swiper-item>
							</block>
						</swiper>
						<!-- </wSkeleton> -->
				   </view>
									
					<!-- #ifdef MP-WEIXIN -->
					<view v-if="adData&&adData.is_show" class="ad-wrap skeleton-rect">
						<ad v-if="adData.type==1" :unit-id="adData.banner_id" :ad-intervals="30"></ad>
						<view v-if="adData.type==2" @click="goApp" class="diy-ad display-flex display-flex-justify-center">
							<image style="height: 130px;width: 100%;" :src="adData.image" ></image>
						</view>
						<view v-if="adData.type==3" @click="goselfApp" class="diy-ad display-flex display-flex-justify-center">
							<image style="height: 130px;width: 100%;"  :src="adData.image" ></image>
						</view>
						<view v-if="adData.type==4">
							<ad v-if="adData.b_type==2" adpid="1128613343" unit-id="adunit-44a2d05a5ce645a4" :ad-intervals="30"></ad>
							<sx-banner  v-if="adData.b_type==1" :unitId="adData.banner_id"></sx-banner>
							
							<sx-cust  v-if="adData.b_type==3" :unitId="adData.cust_id"></sx-cust>
							
							<ad-interstitial v-if="adData.c_type==2"  ref="adinterstitial" @load="onload"   :adpid="1866657604" :loadnext="true" >             </ad-interstitial> 
							<sx-cp v-if="adData.c_type==1"  :unitId="adData.cp_id" ></sx-cp>
						</view>
					</view>
					<!-- #endif -->
				
					 
				</view>
				
				
			</view>
			
			
		</view>
		<view v-else>
			<view class="error-network">
				<image src="https://qiniu.gybsky.cn/def/c6b9a202301051018341210.png?imageMogr2/thumbnail/!80p"></image>
				<view class="title">网络连接断开</view>
				<view class="con">
					<view class="label">请检查情况：</view>
					<view class="item">· 在设置中是否已开启网络权限</view>
					<view class="item">· 当前是否处于弱网环境</view>
					<view class="item">· 版本是否过低，升级试试吧</view>
				</view>
				<view class="btn" @click="reconnect">重新连接</view>
			</view>
		</view>
		
		       
		
			
		<!-- #ifdef MP-WEIXIN -->
		<adPopup :window="adPopup.isShow" :image="adPopup.image" @clickImage="navToPath(adPopup)"  @onColse="adPopup.isShow=false"></adPopup>
			
			
		<aTip :isCustom="true" :text="wxText" :borderR="5"></aTip>
		
		
		
		
		<!-- #endif -->
		<!-- <atModel v-if="locationStatus" :locationType="true" @closeModel="modelCancel" @confirmModel="confirmModel" :content="locationContent"></atModel> -->
		<z-navigation ref="nav"></z-navigation>
		
		

	</view>
</template>


<script>
	let app = getApp();
	import { wSkeleton} from "@/components/wSkeleton/skeleton.vue"
	let statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
	import AnNoticeBar from '@/components/an-notice-bar/an-notice-bar.vue'

	import Cache from '../../utils/cache';
	import { CITY_INFO, LOCATION_CITY_INFO, USER_LOCATION,FROM_ADDRESS } from '../../config/cache.js'
	import store from '../../store/index.js'
	import adPopup from '@/components/adPopup/index';
	import {mapState,} from 'vuex';
	import atModel from '@/components/accredit/index.vue'
	import aTip from '@/components/add-tips/index.vue';
	import { goPage } from '@/libs/iframe.js'
	import animationType from '@/utils/animationType.js' 
    import {
		getTemlIds,
		initLngLat,
		initApp,
		getCouponV2,
		getCouponNewUser,
		getDiy,
		getIndexData,
		getAppVersion,
	} from '@/api/api.js';
	export default {
		name: "home",
		components: {
			adPopup ,atModel, aTip, AnNoticeBar, wSkeleton
		},
		computed: {
		},
		data() {
			return {
				errorNetwork: false,
				aliPayFlag: false,
				animationDatajy: {},
				animationDataddx: {},
				animationDatatd: {},
				animationDatasf: {},
				animationDatafz: {},
				animationDatajyTimer: null,
				animationDataddxTimer: null,
				animationDatatdTimer: null,
				animationDatasfTimer: null,
				animationDatafzTimer: null,
				sharePacket: {
					isState: true, //默认不显示
					touchstart:false
				}, 
				roll: [],
				marTop: 0,
				showSkeleton: true, //骨架屏显示隐藏
				isNodes: 0, //控制什么时候开始抓取元素节点,只要数值改变就重新抓取
				theme: getApp().globalData.theme,
				wxText: "点击 ·•·添加到我的小程序，微信首页下拉即可访问。",
				locationContent:'授权位置信息，提供完整服务',
				locationStatus:false,
			    statusBarHeight: statusBarHeight,
				sList: [],
				notice_mess: '',
				background: {
					backgroundColor: '#ffffff',
				},
				goodsList:[
				],
				
				showNotice: false,
				content: '',
				title:'',
				showCancelButton:'',
				confirmText:'',
				cancelText:'',
				tabCurrent: 0,
				city: '',
				from_address: {},
				to_address: {},
				animationData: {},
				ExAnimationNum: 1,
			
				skeleton_loading: false,
				show: true,
				weather:'',
				startTime: {},
				pageWidith: 375,
				blockWidth: 200,
				blockHeigth: 100,
				bannerList:[],
				menuList:[],
				stationList: [],
				nodata: false, //没有数据提示
				showlocerr: false, //定位是否开启
				openType: true, //最近站点的查看更多
				stationOpenType: 0, //查看的是哪一个站点线路列表，默认最近站点
				indicatorDots: false,
				circular: true,
				autoplay: true,
				interval: 2500,
				duration: 500,
				setInterTime: null ,//定时器对象
				isShowMask:false,//是否是接口请求中
				guideOneTop: 0,
				guideStatus: false,
				adData: null,
				adPopup: {
				  image: "",
				  appid: null,
				  name: "",
				  type: null,
				  url: "",
				  isShow: 0				
				},
				isInitLoc: false,
			}
		},
		destroyed() {
	
			clearInterval(this.animationDataddxTimer);
			clearInterval(this.animationDatatdTimer);
			clearInterval(this.animationDatasfTimer);
			clearInterval(this.animationDatafzTimer);
		},
		onPullDownRefresh(){
			this.initApp()
			this.initLngLat() 
		},
		onLoad() {
			
			this.initApp()
			/***初始化定位***/
			this.initLngLat()
			// uni.navigateTo({
			// 	url:"/pages/bus/baoche/invoice_detail?baoche_id=baoche89050169379366763311625"
			// })
			// uni.navigateTo({
			// 	url:"/pages/scenic/trip_list",
			// })
			// uni.navigateTo({
			// 	url:"/pages/users/exam/index",
			// 	complete(res) {
			// 		console.log('res',res)
			// 	}
			// })
			// uni.navigateTo({
			// 	url:'/pages/bus_pay/index?timeStamp=xxx&nonceStr=xxx&packages=xxx&signType=xxx&paySign=xxx'
			// })
			
			// uni.request({
			// 	url: "http://demo.qsbs.cn/test2",
			// 	success(res) {
			// 		console.log('res',res.data.data)
			// 		var jsconfig = res.data.data
			// 		uni.navigateTo({
			// 			url:'/pages/bus_pay/index?timeStamp='+encodeURIComponent(jsconfig.timestamp)+'&nonceStr='+encodeURIComponent(jsconfig.nonceStr)+'&package='+encodeURIComponent(jsconfig.package)+'&signType='+encodeURIComponent(jsconfig.signType)+'&paySign='+encodeURIComponent(jsconfig.paySign)
			// 		})
			// 	}
			// })
			var that = this
			// console.log(encodeURIComponent("?stationName=贵阳北站"))
			// console.log(`alipays://platformapi/startapp?appId=2021003173665753&pages/real_bus/station_list&query=${encodeURIComponent('stationName=贵阳北站')}`)
			// #ifdef MP-ALIPAY
			my.hideBackHome();
			this.aliPayFlag = true
			// #endif
			// setTimeout(function(){
			// 	that.reddx()
			// 	that.retd()
			// 	that.resf()
			// },500)
			
			// 隐藏原生的tabbar
			setTimeout(() => {
				that.isNodes++;
			}, 100);
			
			uni.getSystemInfo({
				success(s) {
					that.pageWidith = s.screenWidth
					that.blockWidth = ((s.screenWidth-20)/3)-3
					that.blockHeigth = that.blockWidth/2
				}
			})
		
			
		
		  
		 
		  
	
		  //
		 

		},
		
		onShow() {
			this.snycNetWork()
			my.hideBackHome()
			this.$nextTick( () =>{
				this.$refs.nav.initnav()
			})
			
			// 隐藏原生的tabbar
			uni.hideTabBar();

			var that = this
			
			if(!Cache.has(CITY_INFO) && that.isInitLoc == true){
				// #ifdef MP
				uni.getSetting({
				    success: (res) => {
				    let authSetting = res.authSetting
				    if (authSetting['scope.userLocation']) {
				      // 已授权
					  that.initLngLat()
				    } else {
				      uni.showModal({
				        title: '您未开启地理位置授权',
				        content: '是否前往开启位置权限',
				        success: res => {
							console.log(42343,res)
				          if (res.confirm) {
				            uni.openSetting()
				          } else {
							  // uni.navigateTo({
							  // 	url:"/pages/city_select/index"
							  // })
							  Cache.set(CITY_INFO,{id: 2,name: "遵义市",lat: "27.70693",lng: "106.935849"})
							  
						  }
				        }
				      })
				    }
				  }
				})
				//#endif
				// #ifdef APP-PLUS || H5
				uni.navigateTo({
					url:"/pages/city_select/index"
				})
				//#endif
			}
			
			that.from_address = Cache.has(FROM_ADDRESS)? JSON.parse(Cache.get(FROM_ADDRESS)):''
			
			// 如果是选择城市
			var cityInfo = Cache.has(CITY_INFO)? JSON.parse(Cache.get(CITY_INFO)) : ""
			this.city = cityInfo.name
		},
		
		methods: {
			
			snycNetWork() {
				uni.getNetworkType({
					success: res => {
						this.errorNetwork = res.networkType === 'none';
					}
				});
			},
			// 重新链接
			reconnect() {
				uni.getNetworkType({
					success: res => {
						this.errorNetwork = res.networkType === 'none';
						if(!this.errorNetwork){
							
							this.initApp()
							/***初始化定位***/
							this.initLngLat()
						}
					}
				});
			},
			jianxian() { //轮播方法
				var that = this		
				// setTimeout(function(){
					var animation= uni.createAnimation({
									timingFunction: 'ease',
								}) //创建一个动画实例
					//淡入
					// animation.opacity(1).step({duration:3000,delay:1000}) //描述动画
					// that.animationDatajy = animation.export() //输出动画
					animation.opacity(0.3).step()
					that.animationDatajy=animation.export()
					
					setTimeout(function(){
						animation.opacity(1).step({duration:2000})
						that.animationDatajy=animation.export()
					},800)
						//淡出
					// animation.opacity(1).step({duration:3000,delay:1000})
					// that.animationDatajy=animation.export()
					// console.log('that.animationDatajy',that.animationDatajy)
				// },4000)
			},
			reddx: function () {
				var that = this
				
				let animation = uni.createAnimation({
					 delay: 0,
					 duration: 400,
					 timingFunction: 'linear',
				   })
				   // this.animation = animation
				   this.moveDistance = 10
							
				   animation.translateY(5).scale(0.9,0.9).step()
					this.animationDataddx = animation.export()
				
				this.animationDataddxTimer= setInterval(() => {
					  animation.translateY(0).scale(1).step({
						duration: 400
					  })
						that.animationDataddx = animation.export()
					  setTimeout(() => {
						animation.translateY(5).scale(0.9,0.9).step()
							that.animationDataddx = animation.export()
					  }, 400)
					}, 800)
			 },
			refz: function () {
				var that = this
				
				let animation = uni.createAnimation({
					 delay: 0,
					 duration: 1000,
					 timingFunction: 'linear',
				   })
				   this.moveDistance = 10
							
				   animation.scale(0.95,0.95).rotateY(180).step()
					this.animationDatagfz = animation.export()
				
					this.animationDatafzTimer = TimersetInterval(() => {
					  animation.scale(1).rotateY(0).step({
						duration: 1000
					  })
						that.animationDatafz = animation.export()
					  setTimeout(() => {
						animation.scale(0.95,0.95).rotateY(-180).step()
							that.animationDatafz = animation.export()
					  }, 1000)
					}, 2000)
			 },
			retd: function () {
				var that = this
				
				let animation = uni.createAnimation({
					 delay: 0,
					 duration: 400,
					 timingFunction: 'linear',
				   })
				   // this.animation = animation
				   this.moveDistance = 10
							
				   animation.scale(0.95,0.95).rotateZ(10).step()
					this.animationDatatd = animation.export()
				
				 this.animationDatatdTimer =setInterval(() => {
					  animation.scale(1).rotateZ(-10).step({
						duration: 400
					  })
						that.animationDatatd = animation.export()
					  setTimeout(() => {
						animation.scale(0.95,0.95).rotateZ(10).step()
							that.animationDatatd = animation.export()
					  }, 400)
					}, 800)
			 },
			resf: function () {
				var that = this
				
				let animation = uni.createAnimation({
					 delay: 0,
					 duration: 800,
					 timingFunction: 'linear',
				   })
				   this.moveDistance = 10
							
				   animation.rotateY(40).step()
					this.animationDatasf = animation.export()
				
				  this.animationDatasfTimer = 	setInterval(() => {
					  animation.rotateY(0).step({
						duration: 800
					  })
						that.animationDatasf = animation.export()
					  setTimeout(() => {
						animation.rotateY(40).step()
							that.animationDatasf = animation.export()
					  }, 800)
					}, 1600)
			 },
			 reAnimation: function () {
				var that = this
				
				let animation = uni.createAnimation({
				     delay: 0,
				     duration: 600,
				     timingFunction: 'linear',
				   })
				   this.animation = animation
				   this.moveDistance = 10
							
				   animation.scale(0.8,0.8).step()
					this.animationData = animation.export()
				
					setInterval(() => {
					  that.animation.scale(1,1).step({
						duration: 600
					  })
						that.animationData = animation.export()
					  setTimeout(() => {
						that.animation.scale(0.8,0.8).step()
							that.animationData = animation.export()
					  }, 600)
					}, 1200)
			  },
				
			
			
			
			
			initApp(){
				// console.log('showSkeleton',this.showSkeleton)
				uni.showLoading({
					title:"正在初始化"
				})
				var that = this
				initApp().then(res => {
					res = res.data
					that.adPopup = res.adPopup
					that.bannerList = res.banner
					that.menuList = res.menus
					that.notice_mess = res.noticeMess.notice_content
					that.adData= res.homeAd
					that.roll = res.roll
					// #ifdef H5 || APP-PLUS
					that.$store.commit("SET_CHATURL", res.yzfUrl);
					Cache.set('chatUrl', res.yzfUrl);
					// #endif
					Cache.setItem({
						name:'chatConfig',
						value:{
							consumer_hotline:res.consumerHotline,
							telephone_service_switch:res.telephoneServiceSwitch
						}
					});
					
					that.reloadData()
					uni.hideLoading()
					setTimeout(function(){
					
						uni.stopPullDownRefresh();
					},1000)
				}).catch(err => {
					console.log(444,err)
					that.reloadData()
					uni.hideLoading()
					return this.$util.Tips({title: '初始化失败！'});
				})
			},
	
			initLngLat(){
				var that = this
				// if(Cache.has(LOCATION_CITY_INFO)){
				// 	return;
				// }
				uni.getLocation({
						type: 'gcj02',
						altitude: true,
						success: function(res) {
							
							initLngLat({lng: res.longitude,lat: res.latitude,}).then(res2 => {
								that.isInitLoc = true
								res2 = res2.data
								if(res2 && res2.id){
									Cache.set(CITY_INFO,{id: res2.id,name: res2.cityName,lng: res.longitude,lat: res.latitude,})
									
									Cache.set(LOCATION_CITY_INFO,{id: res2.id,name: res2.cityName,lng: res.longitude,lat: res.latitude,})
									
									Cache.set(FROM_ADDRESS,{lng: res.longitude,lat: res.latitude,name:"我的位置"})
									
									
									that.city = res2.cityName
								}
								
								Cache.set(USER_LOCATION,{lng: res.longitude,lat: res.latitude,})
								
								
							}).catch(err => {
								that.isInitLoc = true
								if(!Cache.has(CITY_INFO)){
									uni.navigateTo({
										url:"/pages/city_select/index"
									})
								}
								console.log('err',err)
							})
							
						},
						complete: function(res) {
						},
						fail: function(err){
							console.log('err',err)
							that.isInitLoc = true
							if(!Cache.has(CITY_INFO)){
								uni.navigateTo({
									url:"/pages/city_select/index"
								})
							}
							
						}
					
					});
			},
			
			modelCancel(){
				this.locationStatus = false;
			},
			
			reloadData() {
				this.jianxian()
				// setTimeout(() => {
					
					
				// }, 750)
				this.showSkeleton = false
			},
			
		    userFirstGuide: function() {
				this.guideStatus = false
				uni.setStorage({
					key: "homePageNotice",
					data: true
				})
			},
		
			
		
			
			
			stopTouchMove() {
				return true //禁止新闻swiper手动滑动
			},
			
			initLoc(){
				var that = this
			  var selCity = Cache.has(CITY_INFO)? JSON.parse(Cache.get(CITY_INFO)):""
			  var locCity = Cache.has(LOCATION_CITY_INFO) ?JSON.parse(Cache.get(LOCATION_CITY_INFO)): ""
			  if(locCity && selCity &&selCity.name != locCity.name){
				  uni.showModal({
				      title: "城市切换",
				      content: "您似乎位于"+locCity.name+"，点击切换城市进行切换",
				      confirmColor: "#427CFF",
				      confirmText: "切换城市",
				      success: function (e) {
				          if (e.confirm) try {
							  
							  Cache.set(CITY_INFO,locCity)
							  that.city = locCity.name
				          } catch (e) {
				          }
				      }
				  });
			  }
			},
			
			
            //轮播图
            clickSwip(index){
            	this.navToPath(this.bannerList[index])
             },
			
			
			navToPath(item){
				if(item['type'] == 1){
					
					
					if(item['name'] == "定制公交"){
						
						uni.showModal({
						    title: "温馨提示",
						    content: "定制公交线路正在收集中，请前往发起您的线路吧！",
						    confirmText: "立即前往",
						    success: function (e) {
								if(e.confirm){
									uni.navigateTo({
										url:"/pages/bus/ogz_line/index"
									})
								}
						        
						    },
						});
						return
						// return this.$util.Tips({
						// 	title: '敬请期待！'
						// })'
					}
					 uni.navigateTo({
						url:item.url
					 })
				} else if(item['type']== 2){
					

					// #ifdef MP-WEIXIN
					 uni.navigateToMiniProgram({
					 	appId: item.appid, 
					 	path: item.url,
					 	extraData: {
					 	},
					 	success(res) {
					     // 打开成功
					 	}
					 })
					 // #endif
					 // #ifdef APP-PLUS
					   //需调用plus.share.getServices获取微信分享服务对象    
					  plus.share.getServices((s) => {    
						  let sweixin = {};    
						  for (let i = 0; i < s.length; i++) {    
							  let share = s[i];    
							  if (share.id === 'weixin') {    
								  sweixin = share    
							  }    
						  }    
						  //小程序参数，必填    
						  let WeixinMiniProgramOptions = {    
							  id: item.g_id,    
							  path: item.url,//可指定打开的页面    
						  }    
						  sweixin ? sweixin.launchMiniProgram(WeixinMiniProgramOptions) : plus.nativeUI.alert(    
							  '当前环境不支持微信操作!');    
					  }, function(e) {    
						  console.log("获取分享服务列表失败：" + e.message);    
					  });  
					  // #endif
					// #ifdef MP-ALIPAY
					
					if(item['name'] == "黔爽旅游"){
						return this.$util.Tips({
							title: '请前往微信小程序体验！'
						})
					}
					
					 uni.navigateToMiniProgram({
						appId: '2021003184687759', 
						path: '/pages/home/dashboard/index',
						extraData: {
						},
						success(res) {
						   // 打开成功
						}
					 })
					 // #endif

				}else if(item['type']== 4){
					 uni.switchTab({
						url:item.url
					 })
				} else if(item['type']==5){
					console.log("跳转支付宝页面")
					//跳转支付宝页面
					 // #ifdef MP-ALIPAY
					 my.ap.openURL({
					   url:  item.url, // 请将 url 替换为有效的页面地址
					   success: (res) => {
					     console.log('openURL success', res)
					   },
					   fail: (err) => {
					     console.log('openURL success', err)
					   }
					 });
					  // #endif
					  // #ifdef MP-WEIXIN
					  console.log(2333,item)
					  uni.navigateTo({
					  		url:'/pages/web/web?url='+item.url2
					  })
					   // #endif
					   return
				}else{
					 uni.navigateTo({
						url:'/pages/web/web?url='+item.url
					 })
				}
			},
			menusTap(url) {
				goPage().then(res => {
					{
						uni.navigateTo({
							animationType: animationType.type,
							animationDuration: animationType.duration,
							url: url,
							complete: (res) =>{
								console.log(111,res)
							}
						})
					}
				})
			},
			toNewsList(){
				// uni.navigateTo({
				// 	animationType: animationType.type,
				// 	animationDuration: animationType.duration,
				// 	url:'/pages/news_list/index'
				// })
			},
			bindEdit(name) {
				if (app.globalData.isIframe) {
					window.parent.postMessage({
							name: name
						},
						'*'
					);
					return;
				}
			},
			
			goBus(index){
            	 var item = this.sList[index];
				 console.log(item['type'] == 1)
            	 if(item['type'] == 1){
            		 uni.navigateTo({
            		 	url:item.url
            		 })
            	 } else if(item['type']== 2){
            		 uni.navigateToMiniProgram({
            		   appId: item.appid, 
            		   path: item.url,
            		   extraData: {
            		   },
            		   success(res) {
            		     // 打开成功
            		   }
            		 })
					 
					
            	 } else if(item['type']== 4){
					 uni.switchTab({
					 	url:item.url
					 })
				 }else{
            		 uni.navigateTo({
            		 	url:'/pages/web/web?url='+item.url
            		 })
            	 }
            	
             }, 
			cancel() {
				this.closeModal();
			},
			confirm() {
				this.closeModal();
			},
			closeModal() {
				this.showNotice = false
			},
			onload(e) {
					
			  setTimeout(res => {
				  this.$refs.adinterstitial.show()
			  },3500)
			},
			goselfApp(){
				uni.navigateTo({
					url: this.adData.path,
				})
			},
			goApp(item){
				// #ifdef MP-WEIXIN
				 uni.openEmbeddedMiniProgram({
				 	appId: this.adData.appid, 
				 	path: this.adData.url,
				 	extraData: {
				 	},
				 	success(res) {
				     // 打开成功
				 	}
				 })
				 // #endif
				 // #ifdef APP-PLUS
				   //需调用plus.share.getServices获取微信分享服务对象    
				  plus.share.getServices((s) => {    
					  let sweixin = {};    
					  for (let i = 0; i < s.length; i++) {    
						  let share = s[i];    
						  if (share.id === 'weixin') {    
							  sweixin = share    
						  }    
					  }    
					  //小程序参数，必填    
					  let WeixinMiniProgramOptions = {    
						  id: this.adData.g_id,    
						  path: this.adData.url,//可指定打开的页面    
					  }    
					  sweixin ? sweixin.launchMiniProgram(WeixinMiniProgramOptions) : plus.nativeUI.alert(    
						  '当前环境不支持微信操作!');    
				  }, function(e) {    
					  console.log("获取分享服务列表失败：" + e.message);    
				  });  
				  // #endif
			},
			
			
		
		}
	}
</script>

<style  lang="scss" >
	// page {
	// 	background-color: #f8f8f8 !important;
	// }
	// page {
	// 	background: linear-gradient(to bottom, #007AFF, #007AFF, #007AFF, #efeff4, #efeff4, #efeff4) !important;
	
	// }

	.index-main {
		
		width: 100%;
		margin-bottom: 40upx;
	}

	.main-content {
		margin: 0 20upx;
	}

	.from-to-main {
		border-radius: 25upx;
		/* height: 320upx; */
		margin-top: 20upx;
		padding-bottom: 10px;
	}

	.ft-content {
		margin: 20upx 24upx;
		position: relative;


	}

	.from-flex {
		border-bottom: 2upx solid #f1f1f1;
		margin-bottom: 10px 0;
		width: 267px;
	}

	.ft-content input {
		width: 100%;
		height: 105upx;
		line-height: 105upx;
		font-size: 38upx;
		color: #000;
		font-weight: 600;

	}

	.separation-line {
		height: 1upx;
		background-color: rgb(226, 226, 226);
		width: 75%;
	}

	.change-address {
		/* 	position: absolute;
		top: 0;
		right: 0upx;
		width: 12upx;
		height: 212upx;
		z-index: 1000; */
		align-items: center;

	}

	.imagebox {
		height: 76upx;
		background: url(../../static/images/bus/jiaohuan.png) no-repeat center;
		width: 76upx;
		background-size: 76upx 76upx;
		margin-top: 50upx;
	}

	.item-title {
		font-size: 28upx;
		font-weight: bold;
		padding: 10upx 0 0 0;

	}

	.item-link {
		flex: 1;
		height: 140upx;
		border-radius: 12upx;
		margin-right: 10upx;
		padding: 30upx 0;
		box-sizing: b2628upx;
		color: #fff;
		background: #eee;
		text-align: center;
		align-items: center;
		font-weight: bold;

	}
	
	.item-link-wangyue {
		flex: 1;
		/* height: 140upx; */
		border-radius: 12upx;
		margin-right: 10upx;
		padding: 30upx 50upx;
		box-sizing: border-box;
		font-size: 32upx;
		color: #fff;
		background: #fff;
	/* 	text-align: center; */
		align-items: center;
		font-weight: bold;
	
	}



    .hongse-bg {
		background: linear-gradient(to right, #ffdbdc, #e60000) no-repeat;

	}

	.jingqu-bg {
		background: linear-gradient(to right, #55aa00, #c5ff05) no-repeat;

	}

	.gaote-bg {
		background: linear-gradient(to right, #93a2ff, #c1d4ff) no-repeat;

	}

	.gaoxiao-bg {
		background: linear-gradient(to right, #66bdff, #a9e6ff) no-repeat;

	}

	.jichang-bg {
		background: linear-gradient(to bottom, #a9d6ff, #d4edff) no-repeat;

	}

	.link-title {
		text-shadow: 2upx 2upx 0 rgba(0, 190, 173, 1);

	}

	.link-info {
		font-size: 20upx;
		text-shadow: 0 1upx 4upx rgba(0, 190, 173, 1);

	}

	.link-info text {
		padding-right: 10upx;

	}

	.ad-wrap {
		margin-top: 40upx;
		margin-left: 12px;
		margin-right: 12px;
	}

	.link-ad {
		margin: 0 20upx 0 0;
		padding: 25upx 20upx;
		box-sizing: border-box;
		border-radius: 12upx;

	}

	.link-ad-title {
		font-size: 30upx;
		color: #333;
		font-weight: bold;
		padding: 5upx 0 10upx 0;


	}

	.link-ad-info {
		font-size: 24upx;
		color: #999;

	}

	.tl-wrap {
		display: flex;
		align-items: center;
		padding: 4px 6px 0 6px;
		color: #000;
		font-size: 22upx;
		border-radius: 100upx;
		margin-left: 30upx;
		
	}

	.map-wrap-text {
		padding: 0 6upx;
		font-size: 28upx;
	}
	.t-wrap {
		background-color: #ffffff;
		margin: 10px;
		border-radius: 10px;
	}
	.all-line{
		float: right;
		color: #26a2ff;
		font-size: 12px;
		margin-right: 10px;
	}
	.wd-wrap {
		display: flex;
		align-items: center;
		color: #5e5e5e;
		font-size: 22upx;
		border-radius: 100upx;
		margin-left: 15px;
		padding-left: 9px;
	}

	

   .display-none {
       display: none;
   }
   
   .guide-modal {
       background-color: rgba(0,0,0,.7);
       height: 100%;
       left: 0;
       position: fixed;
       top: 0;
       width: 100%;
       z-index: 101;
   }
   
   .guide-text-wrapper {
       align-items: center;
       display: flex;
       justify-content: center;
       left: 0;
       margin-bottom: 36rpx;
       position: absolute;
       right: 0;
       top: 486rpx;
   }
   
   .guide-text-wrapper .guide-icon {
       height: 97rpx;
       margin-right: 24rpx;
       width: 103rpx;
   }
   
   .guide-text-wrapper .guide-text {
       color: #fff;
       font-size: 32rpx;
       font-weight: 700;
       letter-spacing: 6rpx;
       line-height: 42rpx;
       width: 364rpx;
   }
   
   .guide-2 .guide-text-wrapper .guide-text {
       width: 406rpx;
   }
   
   .guide-info {
	   width: 100%;
       background: #fff;
       box-sizing: border-box;
       font-size: 0;
       overflow: hidden;
       padding: 24rpx 32rpx;
       white-space: nowrap;
   }
   
   .guide-1 .guide-info {
       position: absolute;
       transform: translateY(-24rpx);
   }
   
   .guide-info .schedule {
       border: .5px solid silver;
       border-radius: 10rpx;
       color: #999;
       display: inline-block;
       font-size: 22rpx;
       line-height: 28rpx;
       margin-right: 13rpx;
       padding: 4rpx 20rpx;
   }
   
   .guide-info .schedule.active {
       background-color: #3391e8;
       border: .5px solid #3391e8;
       color: #fff;
   }
   
   .guide-i-know {
       border: 5rpx solid #fff;
       border-radius: 8rpx;
       bottom: 218rpx;
       color: #fff;
       font-size: 24rpx;
       height: 72rpx;
       left: 50%;
       line-height: 72rpx;
       position: absolute;
       text-align: center;
       transform: translateX(-50%);
       width: 252rpx;
   }
   .menu-block {
	   // background-image: linear-gradient(180deg,#fa5956,#fb8650);
	   // height: 60px;
	   // margin-top: 10px;
	   // border-radius: 6rpx;
	   // box-shadow: 0 18rpx 18rpx 0 #e7e7e8;
	      // background: #fff;
	      border-radius: 13rpx;
	      // box-shadow: 0 18rpx 18rpx 0 #e7e7e8;
	      display: inline-block;
	      // height: 125rpx;
	      margin-top: 15px;
	      white-space: nowrap;
		 width: 25%;
		 // width: 25%;
   }
   
   .block-img {
      width: 49px;
	  height: 49px;
	  margin: 0 auto;
   }
   
   .block-text {
       color: #333;
       font-size: 28rpx;
	   margin-top: 8px;
   }
   
   .menu-image{
	      background-image: url(https://pages.c-ctrip.com/basebiz/h5home/v1/nav/main/vacation.png);
	       background-size: 40px auto;
	       background-repeat: no-repeat;
   }
   .item-content {
       align-items: center;
       display: flex;
       height: 100%;
   }
   
   .page-index {
		display: flex;
		flex-direction: column;
		min-height: 100%;
		// background: linear-gradient(180deg, #fff 0%, #f5f5f5 100%);
		background: linear-gradient(to bottom, #007AFF, #0ca2ff, #efeff4, #efeff4, #efeff4, #f5f5f5);
		
	}
   
   .page_content {
		// background-color: #FFFFFF;
	}
   
   /* #ifdef MP || APP-PLUS */
   .mp-header {
    background: #fff;
   	z-index: 999;
   	position: fixed;
   	left: 0;
   	top: 0;
   	width: 100%;
   	/* #ifdef H5 */
   	padding-bottom: 20rpx;
   	/* #endif */
   	// @include main_bg_color(theme);
   
   	.serch-wrapper {
   		height: 100%;
   		align-items: center;
   		padding: 0 50rpx 0 24rpx;
   
   		image {
   			width: 118rpx;
   			height: 42rpx;
   			margin-right: 30rpx;
   		}
   
   		.input {
   			display: flex;
   			align-items: center;
   			/* #ifdef MP-WEIXIN */
   			width: 340rpx;
   			/* #endif */
			/* #ifdef MP-ALIPAY */
			width: 500rpx;
			/* #endif */
   			/* #ifdef APP-PLUS */
   			flex: 1;
   			/* #endif */
   			height: 65rpx;
   			padding: 0 0 0 30rpx;
   			background: rgba(247, 247, 247, 1);
   			border: 1px solid rgba(241, 241, 241, 1);
   			border-radius: 29rpx;
   			color: #BBBBBB;
   			font-size: 28rpx;
   
   			.iconfont {
   				margin-right: 20rpx;
   			}
   		}
   	}
   }
   
   /* #endif */
   
   .header {
   	width: 100%;
   	// @include main_bg_color(theme) padding: 28rpx 30rpx;
   
   	.serch-wrapper {
   		align-items: center;
   
   
   		.logo {
   			width: 118rpx;
   			height: 42rpx;
   			margin-right: 24rpx;
   		}
   
   		image {
   			width: 118rpx;
   			height: 42rpx;
   		}
   
   		.input {
   			display: flex;
   			align-items: center;
   			width: 546rpx;
   			height: 58rpx;
   			padding: 0 0 0 30rpx;
   			background: rgba(247, 247, 247, 1);
   			border: 1px solid rgba(241, 241, 241, 1);
   			border-radius: 29rpx;
   			color: #BBBBBB;
   			font-size: 26rpx;
   
   			.iconfont {
   				margin-right: 20rpx;
   				font-size: 26rpx;
   				color: #666666;
   			}
   		}
   	}
   
   	.tabNav {
   		padding-top: 24rpx;
   	}
   }
   
   .triangle-border-down {
       border: 8rpx solid transparent;
       border-top-color: #000;
       height: 0;
       width: 0;
   }
   	.search-area-block {
   	    align-items: center;
   	    color: #666;
   	    display: flex;
   	    font-size: 24rpx;
   	    height: 80rpx;
   	}
   	.mp-bg {
   		position: absolute;
   		left: 0;
   		/* #ifdef H5 */
   		top: 98rpx;
   		/* #endif */
   		width: 100%;
   		height: 400rpx;
   		@include index-gradient(theme);
   	}
	.swiper {
		position: relative;
		// width: 100%;
		// height: 240rpx !important;
		border-radius: 10rpx;
		// overflow: hidden;
		margin-bottom: 25rpx;
		margin: 12px;
		// /* #ifdef MP */
		z-index: 10;
		// margin-top: 40rpx;
		margin-left: 12px;
		margin-right: 12px;
	
		// /* #endif */
		swiper,
		.swiper-item,
		image {
			width: 100%;
			height: 250rpx;
			border-radius: 10rpx;
		}
	}
	
	.search-line-block {
	    background: #fff;
	    border-radius: 10rpx;
	    box-shadow: 0 7rpx 30rpx 0 rgba(0,0,0,.1);
	    color: #1b1b1b;
	    margin: 24rpx 24rpx 0 24rpx;
	    position: relative;
	}
	
	.search-line-block .address-item {
	    align-items: center;
	    display: flex;
	    height: 102rpx;
	    margin-right: 42rpx;
	}
	
	.search-line-block .address-name {
	    flex: 1;
	    font-size: 32rpx;
	}
	
	.search-line-block .address-icon {
	    height: 18rpx;
	    margin: 0 25rpx 0 50rpx;
	    width: 18rpx;
	}
	
	.search-line-block .address-line-icon {
	    height: 42rpx;
	    left: 56rpx;
	    position: absolute;
	    top: 50%;
	    transform: translateY(-50%);
	    width: 6rpx;
	}
	
	.search-line-block .separation-line {
	    background: #d8d8d8;
	    height: 1rpx;
	    margin-left: 93rpx;
	    margin-right: 42rpx;
	}
	
	.notice {
		margin: 24rpx 24rpx 0 24rpx;
		// width: 100%;
		height: 70rpx;
		border-radius: 10rpx;
		background-color: #fff;
		// margin-bottom: 25rpx;
		line-height: 70rpx;
		padding: 0 14rpx;
		box-shadow: 0 1rpx 8rpx 0 rgba(0, 0, 0, 0.1);
	
		.line2 {
			color: #CCCCCC;
		}
	
		.pic {
			width: 130rpx;
			height: 36rpx;
			background-size: 100%;
			// @include index_new_img(theme);
	
			image {
				width: 100%;
				height: 100%;
				display: block !important;
			}
		}
	
		.swipers {
			height: 100%;
			width: 444rpx;
			overflow: hidden;
	
			swiper {
				height: 100%;
				width: 100%;
				overflow: hidden;
				font-size: 22rpx;
				color: #333333;
			}
		}
	
		.iconfont {
			color: #999999;
			font-size: 20rpx;
		}
	}
	
	
	.menus{
		margin: 10px;
		border-radius: 5px;
		background: #fff;
		padding-bottom: 10px;
	}
</style>
